package com.mldong.badge;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @author mldong
 * @date 2025/9/16
 */
@Service
public class BadgeConfigAggregator {
    @Autowired(required = false)
    private List<BadgeDataProvider> dataProviders;

    public List<MenuBadgeConfig> getAllBadgeConfigs() {
        if (dataProviders == null) {
            return new ArrayList<>();
        }
        return dataProviders.stream()
                .flatMap(provider -> provider.getBadgeConfigs().stream())
                .collect(Collectors.toList());
    }
}
